<script>
    const myinstanceof = (A,B) => {
        let p = A
        while(p){
            if(p === B.prototype){
                return true
            }
            p = p.__proto__
        }
        return false;
    }
    let arr = []
    let obj = {}
    let func = () => {}
    console.log(myinstanceof(arr,Array));//true
    console.log(myinstanceof(arr,Object));//true
    console.log(myinstanceof(func,Object));//true
    console.log(myinstanceof(func,Array));//false
    console.dir(func);
</script>